﻿@namespace Blazorise.Docs.Docs.Examples

<Button Color="Color.Primary" Clicked="@SetPageProgress25">25 %</Button>
<Button Color="Color.Primary" Clicked="@SetPageProgress50">50 %</Button>
<Button Color="Color.Primary" Clicked="@SetPageProgress75">75 %</Button>
<Button Color="Color.Primary" Clicked="@SetPageProgress100">100 %</Button>

<Button Color="Color.Secondary" Clicked="@SetPageProgressIndeterminate">Indeterminate</Button>

<Button Color="Color.Secondary" Clicked="@SetPageProgressHidden">Hide</Button>

@code{
    [Inject] IPageProgressService PageProgressService { get; set; }

    Task SetPageProgress25()
    {
        return PageProgressService.Go( 25, options => { options.Color = Color.Warning; } );
    }

    Task SetPageProgress50()
    {
        return PageProgressService.Go( 50, options => { options.Color = Color.Warning; } );
    }

    Task SetPageProgress75()
    {
        return PageProgressService.Go( 75, options => { options.Color = Color.Warning; } );
    }

    Task SetPageProgress100()
    {
        return PageProgressService.Go( 100, options => { options.Color = Color.Warning; } );
    }

    Task SetPageProgressIndeterminate()
    {
        return PageProgressService.Go( null, options => { options.Color = Color.Warning; } );
    }

    Task SetPageProgressHidden()
    {
        // setting it to -1 will hide the progress bar
        return PageProgressService.Go( -1 );
    }
}